package chapter6;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 计算酬金 这道题目不计算基本工资，只计算提成
 * Date:2021/4/5
运行结果
销售总额    酬金
===========
10000      900.0
15000     1500.0
20000     2100.0
25000     2700.0
30000     3300.0
35000     3900.0
40000     4500.0
45000     5100.0
50000     5700.0
55000     6300.0
60000     6900.0
65000     7500.0
70000     8100.0
75000     8700.0
80000     9300.0
85000     9900.0
90000    10500.0
95000    11100.0
100000    11700.0

 * ***************************************************************
 */
public class exc6_11 {
	
	public static double computeCommission(double  salesAmount) {
		
		double sell=0;
		double earn=0;
//		double earn=5000;  //这道题目不计算基本工资，只计算提成
		while(sell<salesAmount) {
			sell++;
			if(sell>0.01&&sell<=5000) {
				earn=0.08*sell;
			}else if(sell>5000&&sell<=10000) {
				earn=5000*0.08+(sell-5000)*0.10;
			}else {
				earn=5000*0.08+5000*0.10+(sell-10000)*0.12;
			}
		}
		
		return earn;
		
	}
	
	public static void main(String[] args) {
		
		System.out.print("销售总额    酬金\n");
		System.out.print("===========\n");
		for(int i=0;i<19;i++) {
			System.out.printf("%d   %8.1f\n", 10000+i*5000,computeCommission(1.0*   (10000+i*5000)   ));
		}
	}

}
